import pymysql


class MyORM:
    def __init__(self):
        conn = pymysql.connect(
            host='127.0.0.1',
            port=3306,
            user='root',
            password='123456',
            database='mumushouji',
            charset='utf8',
            autocommit=True,
            cursorclass=pymysql.cursors.DictCursor
        )
        cursor = conn.cursor()
        self.cursor = cursor

    def query_user_all(self):
        sql = 'select * from user'
        self.cursor.execute(sql)
        result = self.cursor.fetchall()
        return result


if __name__ == '__main__':
    my_orm = MyORM()
    result = my_orm.query_user_all()
    print(result)
